package com.huazi.www.frontdesk.servlet;

import com.alibaba.fastjson.JSON;
import com.huazi.www.frontdesk.javaBase.ConsumeInfo;
import com.huazi.www.frontdesk.javaBase.PageInfo;
import com.netease.is.sms.demo.utils.SendDemo;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 短信验证
 *
 * @description：
 * @author：zt
 * @date：2021/5/26 14:27
 * @versions：v1.0
 */
public class VerificationServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8"); //修改request域的编码集
        resp.setContentType("text/thml;charse=UTF-8");//修改respones域的编码集
        PrintWriter out = resp.getWriter();
        String phone = req.getParameter("phone");
        SendDemo.sendOtp(phone);
        String jieshou = SendDemo.jieshou;
        String isjieshou = JSON.toJSONString(jieshou);
        out.println(isjieshou);
        out.flush();
        out.close();
    }

}
